package com.ruoyi.hospital.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.hospital.mapper.MaterielInventoryMapper;
import com.ruoyi.hospital.domain.MaterielInventory;
import com.ruoyi.hospital.service.IMaterielInventoryService;

/**
 * 物资库存Service业务层处理
 * 
 * @author qichi
 * @date 2023-07-05
 */
@Service
public class MaterielInventoryServiceImpl implements IMaterielInventoryService 
{
    @Autowired
    private MaterielInventoryMapper materielInventoryMapper;

    /**
     * 查询物资库存
     * 
     * @param id 物资库存主键
     * @return 物资库存
     */
    @Override
    public MaterielInventory selectMaterielInventoryById(Long id)
    {
        return materielInventoryMapper.selectMaterielInventoryById(id);
    }

    /**
     * 查询物资库存列表
     * 
     * @param materielInventory 物资库存
     * @return 物资库存
     */
    @Override
    public List<MaterielInventory> selectMaterielInventoryList(MaterielInventory materielInventory)
    {
        return materielInventoryMapper.selectMaterielInventoryList(materielInventory);
    }

    /**
     * 新增物资库存
     * 
     * @param materielInventory 物资库存
     * @return 结果
     */
    @Override
    public int insertMaterielInventory(MaterielInventory materielInventory)
    {
        materielInventory.setCreateTime(DateUtils.getNowDate());
        return materielInventoryMapper.insertMaterielInventory(materielInventory);
    }

    /**
     * 修改物资库存
     * 
     * @param materielInventory 物资库存
     * @return 结果
     */
    @Override
    public int updateMaterielInventory(MaterielInventory materielInventory)
    {
        materielInventory.setUpdateTime(DateUtils.getNowDate());
        return materielInventoryMapper.updateMaterielInventory(materielInventory);
    }

    /**
     * 批量删除物资库存
     * 
     * @param ids 需要删除的物资库存主键
     * @return 结果
     */
    @Override
    public int deleteMaterielInventoryByIds(Long[] ids)
    {
        return materielInventoryMapper.deleteMaterielInventoryByIds(ids);
    }

    /**
     * 删除物资库存信息
     * 
     * @param id 物资库存主键
     * @return 结果
     */
    @Override
    public int deleteMaterielInventoryById(Long id)
    {
        return materielInventoryMapper.deleteMaterielInventoryById(id);
    }
}
